﻿using DDDSample.Domain.Location;
using FluentNHibernate;
using FluentNHibernate.Mapping;

namespace DDDSample.Domain.NHibernate.Mappings
{
    public class LocationMap : ClassMap<Location.Location>
    {
        public LocationMap()
        {
            Id(x => x.Id).GeneratedBy.Guid();
            Map(x => x.Name).Not.Nullable();
            Component(x => x.UnLocode, m => m.Map(Reveal.Member<UnLocode>("_code"), "UnLocode")
                .Not.Nullable()
                .Access.Field()).Not.Update();
        }
    }
}